package com.mohan.yygh.cmn.listener;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.mohan.model.cmn.Dict;
import com.mohan.vo.cmn.DictEeVo;
import com.mohan.yygh.cmn.service.DictService;
import org.springframework.beans.BeanUtils;

public class DictListener extends AnalysisEventListener<DictEeVo> {
  private DictService dictService;

  public DictListener(DictService dictService) {
    this.dictService = dictService;
  }

  @Override
  public void invoke(DictEeVo dictEeVo, AnalysisContext analysisContext) {
    Dict dict = new Dict();
    BeanUtils.copyProperties(dictEeVo,dict);
    dictService.save(dict);
  }

  @Override
  public void doAfterAllAnalysed(AnalysisContext analysisContext) {

  }
}
